import oauth2AdminApiConfig from '@/core/oauth2/generated/apiconfig/oauth2AdminApiConfig'
import serverApiMockUtils from '../../utils/serverApiMockUtils'
import mockProdServerUtils from '../../utils/mockUtils'
import { MockMethod } from 'vite-plugin-mock'
import Mock from 'mockjs'
import Oauth2RegisteredClientResponse from '@/core/oauth2/generated/types/model/response/Oauth2RegisteredClientResponse'

const content: Oauth2RegisteredClientResponse[] = []
for (let i = 0; i < 10; i++) {
	content.push({
		id: i.toString(),
		clientId: i.toString(),
		clientIdIssuedAt: i.toString(),
		clientSecret: Mock.Random.integer(1, 2) == 1 ? null : `clientSecret_oauth2 客户端_${i.toString()}`,
		clientSecretExpiresAt: Mock.Random.integer(1, 2) == 1 ? null : `clientSecretExpiresAt_oauth2 客户端_${i.toString()}`,
		clientName: `clientName_oauth2 客户端_${i.toString()}`,
		clientAuthenticationMethods: `clientAuthenticationMethods_oauth2 客户端_${i.toString()}`,
		authorizationGrantTypes: `authorizationGrantTypes_oauth2 客户端_${i.toString()}`,
		redirectUris: `redirectUris_oauth2 客户端_${i.toString()}`,
		scopes: `scopes_oauth2 客户端_${i.toString()}`,
		clientSettings: `clientSettings_oauth2 客户端_${i.toString()}`,
		tokenSettings: `tokenSettings_oauth2 客户端_${i.toString()}`,
		deleteFlag: `deleteFlag_oauth2 客户端_${i.toString()}`,
		createTime: new Date().getTime().toString(),
		updateTime: new Date().getTime().toString(),
		rowVersion: 1,
	} as Oauth2RegisteredClientResponse)
}

const mockList: MockMethod[] = [...serverApiMockUtils.getDefaultServerApi(oauth2AdminApiConfig.oauth2RegisteredClient, content)]

mockProdServerUtils.addMockList(...mockList)

export const items = content
